Skip to content

fix: correct checked state when splitting checklist item at line start#87

Merged
j4rviscmd merged 1 commit intomainfrom
fix/checklist-split-fix
Mar 27, 2026
Merged

fix: correct checked state when splitting checklist item at line start#87
j4rviscmd merged 1 commit intomainfrom
fix/checklist-split-fix

Conversation

@j4rviscmd
Copy link
Copy Markdown
Owner

Summary

  • Fix incorrect checked state inheritance when pressing Enter at the beginning of a checked checklist item
  • Intercept Enter key before BlockNote's handler using runsBefore + keyboardShortcuts
  • Perform split with correct states: new line unchecked, original line retains checked state

Problem

When pressing Enter at the text start of a checked ([x]) checklist item:

  • New line incorrectly inherited checked state
  • Original line lost its checked state

Root Cause

BlockNote's splitBlockTr passes keepProps=undefined to tr.split(), which resets checked to false on the new node via attrs: {}. The original node retains checked: true.

Solution

A new BlockNote extension (checklistSplitFixExtension) intercepts the Enter key before check-list-item-shortcuts using runsBefore. For any checklist item (checked or unchecked) with cursor at content start, it inserts a new unchecked checkListItem block before the current one and moves the cursor there.

Test Plan

  • Checked item, Enter at line start → new line unchecked, original stays checked
  • Checked item, Enter mid-text → both stay checked (delegated to BlockNote)
  • Unchecked item, Enter at line start → new line with cursor (delegated to BlockNote)
  • Empty checked item, Enter → converts to paragraph (delegated to BlockNote)
  • Checkbox click toggle → no interference
  • Undo/Redo → works correctly

🤖 Generated with Claude Code

When pressing Enter at the beginning of a checked checklist item,
BlockNote's splitBlockTr resets the checked attribute on the new
node while the original retains its checked state. This intercepts
the Enter key before BlockNote's handler and performs the split
with correct states: new line unchecked, original line checked.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@j4rviscmd j4rviscmd added the bug Something isn't working label Mar 27, 2026
@j4rviscmd j4rviscmd merged commit cd48acd into main Mar 27, 2026
1 of 2 checks passed
@j4rviscmd j4rviscmd deleted the fix/checklist-split-fix branch March 27, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant